import 'package:boss/textStyle/text_style.dart';
import 'package:boss/ui/widget/loader/loader_footer.dart';
import 'package:flutter/material.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

class PullRefreshConfig extends StatelessWidget {
  final Widget child;

  const PullRefreshConfig({@required this.child, Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return RefreshConfiguration(
      headerBuilder: () => ClassicHeader(
        failedText: '刷新失败',
        idleText: '下拉刷新',
        releaseText: '松开刷新',
        refreshingText: '正在刷新',
        completeText: '刷新成功',
        textStyle: TextStyleConstant().normal_4_26,
      ),
      footerBuilder: () => DefaultFooter(),
      hideFooterWhenNotFull: false,
      enableScrollWhenRefreshCompleted: true,
      enableBallisticLoad: true,
      shouldFooterFollowWhenNotFull: (status) => true,
      child: child,
    );
  }
}
